<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="emb.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'viewButton.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	--> 
	<%
	 String srr = (String)request.getParameter("token");
	 String sid=  (String)request.getParameter("idoc");
	 String realPath = request.getRealPath("/");
	 System.out.println("token:"+srr);
	 System.out.println("token:"+sid);
	 %>
<script type="text/javascript">
function testPath()
{
 alert("<%=realPath %>");
}
function testa()
 {
  var doc;
	if(document.all){//IE
	doc = document.frames["ifrChild1"].document;
	}else{//Firefox
	doc = document.getElementById("ifrChild1").contentDocument;
	}
	try{
	  //var doc2 = doc.frames["ifrChild1"].document;
	  var p = document.frames["ifrChild1"].window;
	  //var resultValue = doc2.body.innerHTML;
	//document.getElementById("cme").value=doc3.frames["dlg"].document.body.innerHTML;
	 alert("保存");
	 p.save("");
	 p.resetStatesCB(); p.DS.bUndoableAction=true; p.saveStateCB();
     p.eventManager.notify(p._EVT_PROCESS_QUICK_SAVE);
	}catch(e){alert("webi:err:"+e);}
	

  //var b = p.document.getElementById("dlg");
  //alert("p:"+p.innerHTML);
  //alert(b.innerHTML);
  //p.resetStatesCB(); p.DS.bUndoableAction=true; p.saveStateCB();
  //p.eventManager.notify(p._EVT_PROCESS_QUICK_SAVE);
 }
 function test2()
 {
  var doc;
	if(document.all){//IE
	alert("IE");
	doc = document.frames["ifrChild1"].document;
	}else{//Firefox
	alert("Firefox");
	doc = document.getElementById("ifrChild1").contentDocument;
	}
	var resultValue = doc.body.innerHTML;
	
	alert(resultValue); 
	
 }
 function testb()
 {
  var doc;
	if(document.all){//IE
	doc = document.frames["ifrChild1"].document;
	}else{//Firefox
	doc = document.getElementById("ifrChild1").contentDocument;
	}
	try{
	 var p = document.frames["ifrChild1"].window;
	//document.getElementById("cme").value=doc3.frames["dlg"].document.body.innerHTML;
	 alert("刷新");
	 p.refresh();
	 //p.resetStatesCB(); p.DS.bUndoableAction=true; p.saveStateCB();
     //p.eventManager.notify(p._EVT_PROCESS_QUICK_SAVE);
	}catch(e){alert("webi:err:"+e);}
 }
 </script>
  </head>
  
  <body>
  <FORM name="LoginForm" action="view" method="post">
  	<TABLE>		
	<TR>
		<TD>
			测试页面按钮层：<input type="button" name="test1" value="测试1" onClick="test2()"/>
			<input type="button" name="test1" value="测试保存" onClick="testa()"/>
			<input type="button" name="test1" value="测试刷新" onClick="testb()"/>
			<input type="button" name="test1" value="路径" onClick="testPath()"/></TD>
			<TD><textarea  id="cme" name="cme"></textarea></TD>
	</TR></TABLE>
  <%
	String tokeTemp = "";
	//String[] tt= tokeTemp.split("@");
	String sHomeURL = "http://192.168.150.2:8080/BOE/OpenDocument/opendoc/openDocument.jsp?token=" + srr + "&iDocID="+sid+"&ViewType=I";
	//String openUrl = "";
	String url1 ="http://172.17.79.14:8080/BOE/CMC/1308200853/AnalyticalReporting/webiDHTML/viewer/viewDocument.jsp?"
	+"id="+sid
	+"&actId=3990"
	+"&token="+srr
	+"&pvl=zh_CN&loc=zh_CN&cafWebSesInit=true"
	+"&appKind=OpenDocument"
	+"&bypassLatestInstance=true&showApply=true&service=%2FOpenDocument%2FappService.do"
	+"&objIds="+sid
	+"&containerId=4903&pref=maxOpageU%3D%3BmaxOpageUt%3D200%3BmaxOpageC%3D%3Btz%3DAsia%2FShanghai%3BmUnit%3D%3BshowFilters%3Dtrue%3BsmtpFrom%3Dtrue%3BpromptForUnsavedData%3Dfalse%3B"
	+"&kind=Webi"
	+"&iventrystore=widtoken"
	+"&ViewType=I"
	+"&entSession=CE_ENTERPRISESESSION&lang=zh_CN";
	String url ="http://192.168.150.2:8080/BOE/OpenDocument/1308091025/AnalyticalReporting/webiDHTML/viewer/viewDocument.jsp?"
	+"id="+sid
	+"&actId=3990"
	+"&token="+srr
	+"&pvl=zh_CN&loc=zh_CN&cafWebSesInit=true&appKind=CMC&bypassLatestInstance=true&showApply=true&service=%2Fadmin%2FApp%2FappService.jsp"
	+"&objIds="+sid
	+"&containerId=5369&showSingleChildAction=true&pref=maxOpageU%3D%3BmaxOpageUt%3D200%3BmaxOpageC%3D%3Btz%3DAsia%2FShanghai%3BmUnit%3D%3BshowFilters%3Dtrue%3BsmtpFrom%3Dtrue%3BpromptForUnsavedData%3Dfalse%3B&kind=Webi&iventrystore=widtoken"
	+"&ViewType=I"
	+"&entSession=CE_ENTERPRISESESSION&lang=zh_CN"; %>
	<iframe id="ifrChild1" name="ifrChild1" src="<%=url1 %>" height="789" width="1024"></iframe>
</FORM>
  </body>
</html>
